<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #father{
      border:1px solid #ccc;
      width: 300px;
      height: 300px;
    }
    #son {
      width: 100px;
      height: 100px;
      background: pink;
    }
  </style>
</head>
<body>
  <div id="father">
    <div id="son"></div>
  </div>

  <script>
    var father = document.querySelector('#father')
    var son = document.querySelector('#son')

    son.onclick = function(e) {
      console.log('sonsonson')
      e.stopPropagation()  // 阻止冒泡
    }
    father.onclick = function() {
      console.log('father')
    }
  </script>
</body>
</html>